{% extends "admin/base.html" %}

{% load i18n %}

{% block title %}{% trans "Groups" %}{% endblock %}

{% block content %}
    <div class="text-left">
        <h4 class="px-3">{% trans "Groups" %}</h4>
        <p class="bg-light p-3">
          {% blocktrans %}
            A group - is a collection of users. A groups is a convinient model to group/associate a number of users together. For example only users belonging to accounting group might be allowed to access Accounting-2020 folder.
          {% endblocktrans %}
        </p>
    </div>
    <form action="{% url list_url %}" method="post">
      {% csrf_token %}
        <div class="col-12 p-3">
            <a href="{% url 'admin:group' %}" class="btn btn-success" role="button">{% trans "New Group" %}</a>
              <select name="action" required="">
                <option value="" selected="">---------</option>
                <option value="delete_selected">{% trans "Delete selected groups" %}</option>
              </select>
            <button class="btn btn-outline-dark mx-1" type="submit">{% trans "Go" %}</button>
        </div>

        <div class="col-12 p-3">
          {% if object_list|length > 0 %}
            <table class="table table-striped">
              <thead class="thead-dark">
                <tr class="text-uppercase">
                  <th>
                    <div id="checkbox_view">
                      <span class="mr-2"><input type="checkbox" id="action_toggle"></span>{% trans "Group Name" %}
                    </div>
                  </th>
                </tr>
              </thead>
              <tbody>
                {% for group in object_list %}
                  <tr>
                    <td><span class="mr-2"><input type="checkbox" name="_selected_action" value="{{ group.id }}" /></span><a href="{% url 'admin:group_change' group.id %}">{{ group.name}}</a></td>
                  </tr>
                {% endfor %}
              </tbody>
            </table>
          {% else %}
            {% trans "No groups defined so far" %}
          {% endif %}
      </div>
    </form>
{% endblock %}